import request from '../utils/request'

// 获取地址
export function requestGetAddress() {
    return new Promise(resolve => {
        request.get('/address/list', {
            params: {
                userid: localStorage.getItem('userid')
            }
        }).then(res => {
            resolve(res.data)
        })
    })
}

// 添加地址
export function requestAddAddress(params) {
    return new Promise(resolve => {
        request.post('/address/add', params).then(res => {
            resolve(res.data)
        })
    })
}

//更新地址
export function requestUpdateAddress(params) {
    return new Promise(resolve => {
        request.post('/address/update', params).then(res => {
            resolve(res.data)
        })
    })
}

//删除地址
export function requestRemoveAddress(params) {
    return new Promise(resolve => {
        request.post('/address/delete', params).then(res => {
            resolve(res.data)
        })
    })
}
